<template>
  <view class="bjys2">
    <view @click="navigateBtn()" class="play_back">
      <image src="@/static/img/play_back.png" mode=""></image>
    </view>
    <view class="title">
      自助购卡
    </view>
    <div class="dl_shuru">
      <div class="buycard">
        <div class="cardjs " @click="buycard(mydl.dlurl1)">
          <span v-if="mydl.dlurl1" class="card_time" @click="buycard(mydl.dlurl1)">购买</span>
          <span v-else class="card_time" style="right: -28%;">请联系客服充值</span>
          <image src="@/static/img/buycard1.jpg" mode=""></image>
        </div>
      </div>
      <div class="buycard">
        <div class="cardjs" @click="buycard(mydl.dlurl2)">
          <span v-if="mydl.dlurl2" class="card_time" @click="buycard(mydl.dlurl2)">购买</span>
          <span v-else class="card_time" style="right: -28%;">请联系客服充值</span>
          <image src="@/static/img/buycard2.jpg" mode=""></image>
        </div>
      </div>
      <div class="buycard">
        <div class="cardjs" @click="buycard(mydl.dlurl3)">
          <span v-if="mydl.dlurl3" class="card_time" @click="buycard(mydl.dlurl3)">购买</span>
          <span v-else class="card_time" style="right: -28%;">请联系客服充值</span>
          <image src="@/static/img/buycard3.jpg" mode=""></image>
        </div>
      </div>
    </div>
    <div class="card_sm">
      <p class="wxts">温馨提示：</p>
      <p class="wb">购买卡密后请复制并返回个人中心激活卡密；<br>如卡密使用中遇到问题请联系下方专属客服！</p>
    </div>
    <div class="card_kf">
      <span class="copywx">专属客服微信：{{ mydl.dlwx?mydl.dlwx:'' }}</span>
      <span class="copywx">专属客服QQ：{{ mydl.dlqq?mydl.dlqq:'' }}</span>
    </div>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        password1: '',
        password2: '',
        password3: '',
        mydl: []
      }
    },
    methods: {
      buycard(url){
        // window.location.href = url
        // console.log(url,123)
        // // uni.nage
        plus.runtime.openURL(url, function() {
          console.log(res, 123)
        })
        // uni.navigateTo({
        //   url: '/pages/wevview?url=' + url
        // })
      },
      navigateBtn() {
        uni.navigateBack();
      },

    },
    onLoad() {
      uni.showLoading({
        title:"加载中"
      })
      this.$http.mydaili({
        id: uni.getStorageSync('token')
      }).then(res => {
        if (res.code == 200) {
          uni.hideLoading();
          this.mydl = res.mydl[0];
        }
      })
    }
  }
</script>

<style lang="less">
  .bjys2 {
    padding-top: 50rpx;
    padding-bottom: 20rpx;
    height: 130rpx;
    width: 750rpx;
    top: 0;
    position: absolute;
    width: 100%;
    background: linear-gradient(90deg, #bdc3c7, #2c3e50);
    border-bottom-right-radius: 30rpx;
    border-bottom-left-radius: 30rpx;

    .title {
      margin-bottom: 30rpx;
      position: relative;
      font-size: 32rpx;
      text-align: center;
      color: #FFFFFF;

      image {
        position: absolute;
        right: 30rpx;
        width: 40rpx;
        height: 40rpx;
      }
    }
  }

  .dl_title {
    position: absolute;
    color: white;
    font-size: 20px;
    top: 15px;
    left: 0;
    width: 100%;
    text-align: center;
  }

  .back {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 30px;
    height: 30px;
    background-image: url(../assets/img/play_back.png);
    background-position: 50%;
    background-repeat: no-repeat;
    background-size: cover;
    z-index: 20;
  }

  .dl_shuru {
    position: absolute;
    top: 70px;
    margin: auto;
    max-width: 414px;
    width: 100%;
  }

  .card_sm {
    position: absolute;
    top: 300px;
    margin: 10px;
    max-width: 392px;
    width: 94%;
    background: #eaeef1;
    border-radius: 20px;
  }

  .card_kf {
    position: absolute;
    top: 400px;
    max-width: 414px;
  }

  .cardjs {
    position: relative;
    width: 46%;
    border-radius: 20px;
    float: left;
    margin: 2%;
    height: 100px;
    overflow: hidden;

    image {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
    }

    span {
      position: relative;
      z-index: 9;
    }
  }

  .cardpic1 {
    background-image: url('../assets/img/buycard1.jpg');
  }

  .cardpic2 {
    background-image: url('../assets/img/buycard2.jpg');
  }

  .cardpic3 {
    background-image: url('../assets/img/buycard3.jpg');
  }

  .card_time {
    font-size: 14px;
    font-weight: 700;
    position: relative;
    top: 65px;
    color: #3b4b5c;
    right: -65%;
    background: white;
    padding: 3px 8px;
    border-radius: 50px;
  }

  .wxts {
    font-size: 13px;
    color: #98a1a9;
    padding: 10px;
  }

  .wb {
    font-size: 14px;
    padding: 0 10px 10px 10px;
  }

  .copywx {
    width: 67%;
    margin: 10px 0 0 10px;
    float: left;
    font-size: 15px;
    line-height: 30px;
    padding-left: 2%;
  }

  .fzan {
    margin: 10px 0 0 10px;
    border-radius: 30px;
    width: 23%;
    margin-left: 10px;
    padding: 8px;
    float: left;
    font-size: 14px;
  }
</style>
